import 'package:flutter/material.dart';

class HomeShopList extends StatelessWidget {
  const HomeShopList({super.key, required this.goodsList});
  final List goodsList;

  @override
  Widget build(BuildContext context) {
    return ListView.separated(
      shrinkWrap: true,
      physics: const NeverScrollableScrollPhysics(),
      itemBuilder: (context, index) {
        return Container(
          height: 100,
          color: Colors.white,
          child: Container(
            padding: const EdgeInsets.all(10),
            child: Row(
              children: [
                Image.network(
                  goodsList[index]['goods_image'],
                  width: 80,
                  height: 80,
                ),
                const SizedBox(
                  width: 10,
                ),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        '${goodsList[index]['goods_name']}',
                        maxLines: 2,
                        overflow: TextOverflow.ellipsis,
                      ),
                      Expanded(
                        child: Text(
                          '已售${goodsList[index]['goods_sales']}件',
                          style: const TextStyle(color: Colors.grey),
                        ),
                      ),
                      Expanded(
                        child: Row(
                          children: [
                            Text('￥${goodsList[index]['goods_price_min']}',
                                style: const TextStyle(color: Colors.red)),
                            const SizedBox(width: 10),
                            Text(
                              '￥${goodsList[index]['line_price_min']}',
                              style: const TextStyle(
                                  decoration: TextDecoration.lineThrough),
                            )
                          ],
                        ),
                      )
                    ],
                  ),
                ),
              ],
            ),
          ),
        );
      },
      separatorBuilder: (context, index) {
        return const Divider(
          height: 10,
          color: Colors.red,
        );
      },
      itemCount: goodsList.length,
    );
  }
}
